package com.moneywelcome.loanservicefacade.api;

import com.moneywelcome.loanservicefacade.forms.AuthenticateForm;
import com.moneywelcome.loanservicefacade.forms.LoanForm;
import com.moneywelcome.loanservicefacade.info.LoanInfo;
import com.moneywelcome.loanservicefacade.info.OverdueRecordsInfo;
import com.moneywelcome.params.PageParam;
import com.moneywelcome.results.PageResult;
import com.moneywelcome.results.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.io.FileNotFoundException;


@Api(tags = "贷款服务")
@FeignClient(value = "credit-loan-service",contextId = "LoanService")
public interface LoanServiceApi {

    @ApiOperation("用户贷款")
    @PostMapping("loan")
    Result loan(@RequestBody LoanForm form);

    @ApiOperation("资质申请")
    @PostMapping("authenticate")
    Result authenticate(@RequestBody AuthenticateForm form) throws FileNotFoundException;

    @ApiOperation("获取所有贷款产品")
    @GetMapping("loanProducts")
    Result loanProduct(@RequestBody PageParam pageParam);

    @ApiOperation("根据用户id获取贷款")
    @GetMapping("loanInfo/{userId}")
    Result<PageResult<LoanInfo>> getLoanByUser(@PathVariable("userId")Integer userId,@RequestBody PageParam pageParam);

    @ApiOperation("根据登录用户获取贷款")
    @GetMapping("loanInfo")
    Result<PageResult<LoanInfo>> getLoanByUser(@RequestBody PageParam pageParam);

//    @ApiOperation("根据登录用户获取贷款合同")
//    @GetMapping("userContract")
//    Result getContractByUser();

    @ApiOperation("获取所有用户所有未处理逾期记录")
    @GetMapping("overdueRecords")
    Result<PageResult<OverdueRecordsInfo>> getOverdueRecords();

    @ApiOperation("登录用户查询逾期记录")
    @GetMapping("userOverdueRecord")
    Result<PageResult<OverdueRecordsInfo>> userOverdueRecord();
}
